package Eyjafjalla.action;

import Eyjafjalla.patch.CloudPatch;
import Eyjafjalla.power.FollowHeartPower;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.actions.common.ApplyPowerAction;
import com.megacrit.cardcrawl.actions.common.ExhaustSpecificCardAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;

import java.util.ArrayList;

public class FollowHeartAction extends AbstractGameAction {
    public FollowHeartAction(boolean toHand){
        this.toHand = toHand;
    }

    boolean toHand;

    @Override
    public void update() {
        if(CloudPatch.cloudGroup.size()>0){
            ArrayList<AbstractCard> cards = new ArrayList<>(CloudPatch.cloudGroup.group);
            addToTop(new ApplyPowerAction(AbstractDungeon.player,AbstractDungeon.player,new FollowHeartPower(AbstractDungeon.player,cards,toHand)));
            for(AbstractCard c:cards){
                addToTop(new ExhaustSpecificCardAction(c,CloudPatch.cloudGroup,true));
            }
        }

        this.isDone = true;
    }
}
